/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ebook;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author TOSHIBA
 */
@Entity
@Table(name = "tempbook", catalog = "library", schema = "")
@NamedQueries({@NamedQuery(name = "Tempbook.findAll", query = "SELECT t FROM Tempbook t"), @NamedQuery(name = "Tempbook.findByTitle", query = "SELECT t FROM Tempbook t WHERE t.title = :title"), @NamedQuery(name = "Tempbook.findByAuthor", query = "SELECT t FROM Tempbook t WHERE t.author = :author"), @NamedQuery(name = "Tempbook.findByPublisher", query = "SELECT t FROM Tempbook t WHERE t.publisher = :publisher"), @NamedQuery(name = "Tempbook.findByContent", query = "SELECT t FROM Tempbook t WHERE t.content = :content"), @NamedQuery(name = "Tempbook.findByTag", query = "SELECT t FROM Tempbook t WHERE t.tag = :tag"), @NamedQuery(name = "Tempbook.findByPaths", query = "SELECT t FROM Tempbook t WHERE t.paths = :paths")})
public class Tempbook implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "title")
    private String title;
    @Basic(optional = false)
    @Column(name = "author")
    private String author;
    @Basic(optional = false)
    @Column(name = "publisher")
    private String publisher;
    @Id
    @Basic(optional = false)
    @Column(name = "content")
    private String content;
    @Basic(optional = false)
    @Column(name = "tag")
    private String tag;
    @Basic(optional = false)
    @Column(name = "paths")
    private String paths;

    public Tempbook() {
    }

    public Tempbook(String content) {
        this.content = content;
    }

    public Tempbook(String content, String title, String author, String publisher, String tag, String paths) {
        this.content = content;
        this.title = title;
        this.author = author;
        this.publisher = publisher;
        this.tag = tag;
        this.paths = paths;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        String oldTitle = this.title;
        this.title = title;
        changeSupport.firePropertyChange("title", oldTitle, title);
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        String oldAuthor = this.author;
        this.author = author;
        changeSupport.firePropertyChange("author", oldAuthor, author);
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        String oldPublisher = this.publisher;
        this.publisher = publisher;
        changeSupport.firePropertyChange("publisher", oldPublisher, publisher);
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        String oldContent = this.content;
        this.content = content;
        changeSupport.firePropertyChange("content", oldContent, content);
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        String oldTag = this.tag;
        this.tag = tag;
        changeSupport.firePropertyChange("tag", oldTag, tag);
    }

    public String getPaths() {
        return paths;
    }

    public void setPaths(String paths) {
        String oldPaths = this.paths;
        this.paths = paths;
        changeSupport.firePropertyChange("paths", oldPaths, paths);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (content != null ? content.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tempbook)) {
            return false;
        }
        Tempbook other = (Tempbook) object;
        if ((this.content == null && other.content != null) || (this.content != null && !this.content.equals(other.content))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ebook.Tempbook[content=" + content + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
